package com.longteng.lesson2.service.impl;

import com.longteng.lesson2.domain.Order;
import com.longteng.lesson2.domain.Sku;
import com.longteng.lesson2.service.OrderSubmit;

import java.util.List;

/**
 * Created by taki
 * DATE : 2018/11/4 0004
 * TIME : 22:58
 * PROJECT : java-lesson
 * PACKAGE : com.longteng.lesson
 *
 * @author <a href="mailto:165157905@qq.com">taki</a>
 */
public class OrderSubmitImpl implements OrderSubmit {
    @Override
    public int pay(Order order) {
        int m= order.getMoney();
        List<Sku> skuList = order.getSkuList();
        for(int i=0;i<skuList.size();i++){
           Sku sku= skuList.get(i);
           int price = sku.getPrice();
           m+=price;
        }
        System.out.println("价格:"+m);
        return m;
    }
}
